<?php


namespace app\common\model;
use think\Model;

class UUser extends Model
{
    /**
     * @param number $uid 用户uid
     * @return array user_msg 用户所有信息
     */
    public function get_user_msg($uid)
    {
        if(!isset($uid) || !is_numeric($uid)) {
            exception('非法传参');
        }
        $data = [
            'user_id' => $uid
        ];
        return $this->where($data)->find();
    }

    /*
    public function get_this_colnum($uid,$select_data = ['user_id'])
    {
        if(!isset($uid) || !is_numeric($uid)) {
            exception('非法传参');
        }
        $data = [
            'user_id' => $uid
        ];
        return $this->where($data)->column('test',$select_data);
    }
    */

    public function update_user_msg($user_id,$data = [])
    {
        $rule = [
            'user_id' => $user_id
        ];
        return $this->allowField(true)->save($data,$rule);
    }
}
